// ***************************************************************
//  assert_helper   version:  1.0    date: 2008/07/26 - 08/08
//  Copyright (C) 2008 Aotain Comp. All Rights Reserved
//  -------------------------------------------------------------
//  Description:
//  Author: pankai
//  -------------------------------------------------------------
//  History:
// ***************************************************************

#include <assert.h>

#define IF_NOT_EQUAL_RETURN(EXPECTED, ACTUAL) \
assert(EXPECTED == ACTUAL); \
if (EXPECTED != ACTUAL) return;

#define IF_EQUAL_RETURN(EXPECTED, ACTUAL) \
assert(EXPECTED != ACTUAL); \
if (EXPECTED == ACTUAL) return;

#define IF_NOT_EQUAL_RETURN_VALUE(EXPECTED, ACTUAL, VALUE) \
assert(EXPECTED == ACTUAL); \
if (EXPECTED != ACTUAL) return VALUE;

#define IF_EQUAL_RETURN_VALUE(EXPECTED, ACTUAL, VALUE) \
assert(EXPECTED != ACTUAL); \
if (EXPECTED == ACTUAL) return VALUE;

#define IF_NULL_RETURN_VALUE(CONDITION, VALUE) IF_EQUAL_RETURN_VALUE(0, CONDITION, VALUE)
#define IF_NULL_RETURN(CONDITION) IF_EQUAL_RETURN(0, CONDITION)

#define IF_FALSE_RETURN_VALUE(CONDITION, VALUE) IF_EQUAL_RETURN_VALUE(false, CONDITION, VALUE)
#define IF_TRUE_RETURN_VALUE(CONDITION, VALUE) IF_EQUAL_RETURN_VALUE(true, CONDITION, VALUE)
#define IF_FALSE_RETURN(CONDITION) IF_EQUAL_RETURN(false, CONDITION)
#define IF_TRUE_RETURN(CONDITION) IF_EQUAL_RETURN(true, CONDITION)
